package com.wwg.design.patten.observer.case1;

/**
 * @类描述: TODO
 * @Author wwg
 * @date: 2021/7/20 18:54
 * @Version: 1.0
 **/
public class Subject extends AbstractSubject{

    /**
     * 主题
     */
    private String name;
    /**
     * 发生了 什么
     */
    private String happenWhat;

    public String getHappenWhat() {
        return happenWhat;
    }

    public Subject(String name, String happenWhat) {
        this.name = name;
        this.happenWhat = happenWhat;
    }

    public void setHappenWhat(String happenWhat) {
        this.happenWhat = happenWhat;
    }

    public Subject(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void someThingHappen(String happenWhat) {
        String x = "主题：" + name + "，发生事件：" + happenWhat;
        System.out.println(x);
        notifyAllObserver(x);
    }

}
